﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;


namespace SangoBang
{
    using Cards.Characters;
    class Player : IComparable
    {
        public Player(String name)
        {
            this.mName = name;
        }

        private Game game;
        private int hp;
        private int cardNumber = 4;

        public String mName;
        public String Guid;
        public Player Next;
        public Game Game
        {
            get { return game; }
            set { game = value; }
        }

        public int HP
        {
            get { return hp; }
            set { hp = value; }
        }

        public int CardNumber
        {
            get { return cardNumber; }
            set { cardNumber = value; }
        }
        
        public EventWaitHandle MessageEvent = new AutoResetEvent(false);
        public Queue<String> MessageQueue = new Queue<string>();

        public String mRole {
            set{
                mRoleValue = value;
                Console.WriteLine(mName + "'s role is " + mRoleValue);
            }
            get { return mRoleValue; }
        }
        private String mRoleValue;

        public String mCharacterName
        {
            set
            {
                mCharacterNameValue = value;
                Console.WriteLine(mName + "'s character is " + mCharacterNameValue);
                
            }
            get { return mCharacterNameValue; }
        }
        private String mCharacterNameValue;

        public Character mCharacter
        {
            set
            {
                mCharacterValue = value;
                Console.WriteLine(mName + "'s character has " + mCharacter.mHitPoint + " HP");
            }
            get { return mCharacterValue; }
        }
        private Character mCharacterValue;



        #region IComparable Members

        public int CompareTo(object obj)
        {
            if (obj is Player)
            {
                Player otherPlayer = (Player)obj;
                return this.mName.CompareTo(otherPlayer.mName);
            }
            else
            {
                throw new ArgumentException("object is not a Player");
            } 
        }

        #endregion

    }
}
